home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 July / EnigmA AMIGA RUN 09 (1996)(G.R. Edizioni)(IT)[!][issue 1996-07 & 08][EARSAN CD VIII].iso / earcd / util3 / fiflb382.lha / htag.S < prev    next >
Text File  |  1996-04-02  |  1KB  |  67 lines

  1.  
  2. |    FIFO-HANDLER HTAG.S for GCC, including startup code
  3. |    ATTENTION: Beware of pc@(label+2) bug in gas prior to 2.5.2!!!
  4. |    ATTENTION: pc@(label) generates non-68000 code in some gas
  5.  
  6. |    Simple startup code, not runnable from WorkBench
  7. |    Just handle _SysBase and _DOSBase
  8.  
  9. #ifdef USE_PC_REL
  10. #define PC_REL(a) pc@(a)
  11. #else
  12. #define PC_REL(a) a
  13. #endif
  14.  
  15. .text
  16.     .even
  17. .globl _ENTRY
  18. _ENTRY:
  19.     |  need not save registers (GURU book 20.2.1.1)
  20.     movel sp,___ExitSP
  21.     movel 4:w,a6
  22.     movel a6,_SysBase
  23.     |  OpenLibrary(dos)
  24.     lea  PC_REL(LDOSname),a1
  25.     moveq #0,d0
  26.     jsr a6@(-0x228)
  27.     movel d0,_DOSBase
  28.     jeq L102    |  0 exit status when no Dos...
  29.     |  call _main(void);
  30.     jbsr PC_REL(__main)
  31.     movel d0,d2
  32.     jra L101
  33. .globl __exit
  34. __exit:
  35.     movel sp@(4),d2
  36. L101:
  37.     |  CloseLibrary(dos)
  38.     movel _SysBase,a6
  39.     movel _DOSBase,a1
  40.     jsr a6@(-0x19e)
  41.     movel d2,d0
  42. L102:
  43.     movel ___ExitSP,sp
  44.     rts
  45. LDOSname:
  46.     .ascii "dos.library\0"
  47.  
  48. .data
  49.     .even
  50. .comm ___ExitSP,4
  51. .comm _SysBase,4
  52. .comm _DOSBase,4
  53.  
  54.  
  55.  
  56. |    Support for software int to transfer packet from
  57. |    private port to IoSink
  58.  
  59. .text
  60.     .even
  61. .globl _AIntCode
  62. _AIntCode:
  63.     movel a1,sp@-
  64.     jsr PC_REL(_IntCode)
  65.     movel sp@+,a1
  66.     rts
  67.